<template>
  <div class="app-container">

    <!--
       查询条件
     -->
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="昵称" prop="nickname">
        <el-input
          v-model="queryParams.nickname"
          placeholder="请输入昵称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="手机号" prop="phone">
        <el-input
          v-model="queryParams.phone"
          placeholder="请输入手机号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证号" prop="idNumber">
        <el-input
          v-model="queryParams.idNumber"
          placeholder="请输入身份证号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="账号类型" prop="accountType">
        <el-select v-model="queryParams.accountType" placeholder="请选择账号类型" clearable size="small">
          <el-option
            v-for="dict in accountTypeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="是否充值" prop="recharge">
        <el-select v-model="queryParams.recharge" placeholder="请选择是否充值" clearable size="small">
          <el-option
            v-for="dict in rechargeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="邀请码" prop="invitationCode">
        <el-input
          v-model="queryParams.invitationCode"
          placeholder="请输入邀请码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="上级邀请码" prop="invitationParent">
        <el-input
          v-model="queryParams.invitationParent"
          placeholder="请输入上级邀请码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="钱包余额" prop="szWalletBalance">
        <el-input
          type="number"
          v-model="queryParams.szWalletBalance"
          placeholder="请输入钱包余额"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="提现钱包余额" prop="szWithdrawalBalance">
        <el-input
          type="number"
          v-model="queryParams.szWithdrawalBalance"
          placeholder="请输入提现钱包余额"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="提现冻结金额" prop="frozenAccount">
        <el-input
          type="number"
          v-model="queryParams.frozenAccount"
          placeholder="请输入提现冻结金额"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="代理等级" prop="szAgency">
        <el-select v-model="queryParams.szAgency" placeholder="请选择代理等级" clearable size="small">
          <el-option
            v-for="dict in agencyOptions"
            :key="dict.dmcod"
            :label="dict.dmcpt"
            :value="dict.dmcod"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="能量值" prop="szEnergy">
        <el-input
          type="number"
          v-model="queryParams.szEnergy"
          placeholder="请输入能量值"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否开通" prop="szEnable">
        <el-select v-model="queryParams.szEnable" placeholder="请选择是否开通" clearable size="small">
          <el-option
            v-for="dict in szEnableOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="开通时间" prop="szEnableTime">
        <el-date-picker clearable size="small"
          v-model="queryParams.szEnableTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择开通时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="账号状态" prop="isSignOut">
        <el-select v-model="queryParams.isSignOut" placeholder="账号状态" clearable size="small">
          <el-option
            v-for="dict in signOutOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="直播状态" prop="isFrozen">
        <el-select v-model="queryParams.isFrozen" placeholder="直播状态" clearable size="small">
          <el-option
            v-for="dict in frozenOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="代金卷余额" prop="voucher">
        <el-input
          type="number"
          v-model="queryParams.voucher"
          placeholder="请输入代金卷余额"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!--
      操作按钮
     -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['finance:szUser:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-refresh"
          size="mini"
          :disabled="multiple"
          @click="resetLoginPassword"
          v-hasPermi="['finance:szUser:resetLoginPassword']"
        >重置登录密码</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-link"
          size="mini"
          :disabled="multiple"
          @click="resetPaymentPassword"
          v-hasPermi="['finance:szUser:resetPaymentPassword']"
        >重置支付密码</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['finance:szUser:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!--
      表格数据
     -->
    <el-table :cell-style="columnStyle"  border v-loading="loading" :data="szUserList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="昵称" width="100" align="center" prop="nickname" fixed="left"/>
      <el-table-column label="手机号" width="120" align="center" prop="phone" />
      <el-table-column label="登录密码" width="120" align="center" prop="password" />
      <!-- <el-table-column label="登录密码" width="120" align="center" prop="password" >
        <template slot-scope="scope">
          <el-popover
            placement="top-start"
            trigger="click"
            :content="scope.row.password">
            <el-button style="border: 0px;" slot="reference">{{scope.row.passwordMiwen}}</el-button>
          </el-popover>
        </template>
      </el-table-column> -->
      <el-table-column label="支付密码" width="120" align="center" prop="paymentPassword" >
        <template slot-scope="scope">
          <el-popover
            placement="top-start"
            trigger="click">
            <div style="width: 100%;height: 100%; text-align: center;">{{ scope.row.paymentPassword }}</div>
            <el-button style="border: 0px;" slot="reference">{{scope.row.paymentPasswordMiwen}}</el-button>
          </el-popover>
        </template>
      </el-table-column>
      <el-table-column label="身份证号" width="170" align="center" prop="idNumber" />
      <el-table-column label="头像" width="90" align="center" prop="avatar" >
        <template slot-scope="scope">
          <el-avatar :src="scope.row.avatar"></el-avatar>
        </template>
      </el-table-column>
      <el-table-column label="账号类型" width="90" align="center" prop="accountType">
        <template slot-scope="scope">
          <dict-tag :options="accountTypeOptions" :value="scope.row.accountType"/>
        </template>
      </el-table-column>
      <el-table-column label="近登录时间" align="center" prop="lastLoginTime" width="160">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastLoginTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="最近登录ip" width="130" align="center" prop="lastLoginIp" />
      <el-table-column label="账号状态" align="center" prop="signOutName" width="160">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.isSignOut === '0'">{{ scope.row.signOutName }}</el-tag>
          <el-tag v-else type="info">{{ scope.row.signOutName }}<br>{{ scope.row.signOutTime }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="直播状态" align="center" prop="frozenName" width="160">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.isFrozen === '0'">{{ scope.row.frozenName }}</el-tag>
          <el-tag v-else type="info">{{ scope.row.frozenName }}<br>{{ scope.row.frozenTime }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="注册时间" align="center" prop="registerTime" width="160">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.registerTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="最近密码修改时间" align="center" prop="lastUpdatePassword" width="160">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastUpdatePassword, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column label="是否充值" align="center" prop="recharge">
        <template slot-scope="scope">
          <dict-tag :options="rechargeOptions" :value="scope.row.recharge"/>
        </template>
      </el-table-column> -->
      <el-table-column label="是否开通" align="center" prop="szEnable">
        <template slot-scope="scope">
          <dict-tag :options="szEnableOptions" :value="scope.row.szEnable"/>
        </template>
      </el-table-column>
      <el-table-column label="开通时间" align="center" prop="szEnableTime" width="160">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.szEnableTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="代理等级" align="center" prop="angencyName" />
      <el-table-column label="钱包余额" width="100" align="center" prop="szWalletBalance" />
      <el-table-column label="待激活余额" width="100" align="center" prop="pendingActivationBalance" />
      <el-table-column label="提现钱包余额" width="110" align="center" prop="szWithdrawalBalance" />
      <el-table-column label="提现冻结金额" width="110" align="center" prop="frozenAccount" />
      <el-table-column label="能量值" align="center" prop="szEnergy" />
      <!-- <el-table-column label="代金卷余额" width="100" align="center" prop="voucher" /> -->
      <!-- <el-table-column label="团队奖励累计收益" width="130" align="center" prop="szTeamReward" />
      <el-table-column label="极差奖励累计收益" width="130" align="center" prop="szRangeReward" />
      <el-table-column label="平级累计累计收益" width="130" align="center" prop="szLateralReward" />
      <el-table-column label="复购奖励累计收益" width="130" align="center" prop="szRepeatbuyReword" /> -->
      <el-table-column label="邀请码" align="center" width="110" prop="invitationCode" />
      <el-table-column label="上级邀请码" width="110" align="center" prop="invitationParent">
        <template slot-scope="scope">
          <span>{{ scope.row.parentName }}<br>{{ scope.row.invitationParent }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['finance:szUser:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-refresh"
            @click="resetLoginPassword(scope.row)"
            v-hasPermi="['finance:szUser:resetLoginPassword']"
          >重置登录密码</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-link"
            @click="resetPaymentPassword(scope.row)"
            v-hasPermi="['finance:szUser:resetPaymentPassword']"
          >重置支付密码</el-button>
          <el-button
            size="mini"
            type="text"
            :icon="scope.row.isSignOut === '0' ? 'el-icon-video-pause' : 'el-icon-video-play'"
            @click="logoutOrEnable(scope.row)"
            v-hasPermi="['finance:szUser:logoutOrEnable']"
          >注销/启用</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="deleteUser(scope.row)"
            v-hasPermi="['finance:szUser:deleteUser']"
          >删除用户</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加平台用户对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="40%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="昵称" prop="nickname">
          <el-input v-model="form.nickname" placeholder="请输入昵称" style="width: 90%;"/>
        </el-form-item>
        <el-form-item label="手机号" prop="phone">
          <el-input v-model="form.phone" placeholder="请输入手机号" style="width: 90%;"/>
        </el-form-item>
        <el-form-item label="身份证号" prop="idNumber">
          <el-input v-model="form.idNumber" placeholder="请输入身份证号" style="width: 90%;"/>
        </el-form-item>
        <el-form-item label="头像">
          <ImageUploadQN v-model="form.avatar"/>
        </el-form-item>
        <el-form-item label="账号类型" prop="accountType">
          <el-select v-model="form.accountType" placeholder="请选择账号类型">
            <el-option
              v-for="dict in accountTypeOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="上级邀请码" prop="invitationParent">
          <el-input v-model="form.invitationParent" placeholder="请输入上级邀请码" style="width: 90%;"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 修改平台用户对话框 -->
    <el-dialog title="修改平台用户" :visible.sync="openEdit" width="40%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="130px">
        <el-form-item label="昵称" prop="nickname">
          <el-input v-model="form.nickname" placeholder="请输入昵称" style="width: 90%;"/>
        </el-form-item>
        <el-form-item label="手机号" prop="phone">
          <el-input v-model="form.phone" placeholder="请输入手机号" style="width: 90%;"/>
        </el-form-item>
        <el-form-item label="身份证号" prop="idNumber">
          <el-input v-model="form.idNumber" placeholder="请输入身份证号" style="width: 90%;"/>
        </el-form-item>
        <el-form-item label="头像">
          <ImageUploadQN v-model="form.avatar"/>
        </el-form-item>
        <el-form-item label="账号类型" prop="accountType">
          <el-select v-model="form.accountType" placeholder="请选择账号类型">
            <el-option
              v-for="dict in accountTypeOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="钱包余额" prop="szWalletBalance">
          <el-input type="number" v-model="form.szWalletBalance" placeholder="钱包余额" style="width: 90%;"/>
        </el-form-item>
        <el-form-item label="提现钱包余额" prop="szWithdrawalBalance">
          <el-input type="number" v-model="form.szWithdrawalBalance" placeholder="提现钱包余额" style="width: 90%;"/>
        </el-form-item>
        <el-form-item label="提现冻结金额" prop="frozenAccount">
          <el-input type="number" v-model="form.frozenAccount" placeholder="提现冻结金额" style="width: 90%;"/>
        </el-form-item>
        <el-form-item label="能量值" prop="szEnergy">
          <el-input type="number" v-model="form.szEnergy" placeholder="能量值" style="width: 90%;"/>
        </el-form-item>
        <el-form-item label="上级邀请码" prop="invitationParent">
          <el-input v-model="form.invitationParent" placeholder="无邀请人" style="width: 90%;"/>
        </el-form-item>
        <!-- <el-form-item label="代金卷余额" prop="voucher">
          <el-input type="number" v-model="form.voucher" placeholder="代金卷余额" style="width: 90%;"/>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormEdit">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import { deleteUser,logoutOrEnable,resetPaymentPassword,listSzVipRule,listSzUser, getSzUser, resetLoginPassword, addSzUser, updateSzUser, exportSzUser } from "@/api/finance/szUser";

export default {
  name: "SzUser",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 平台用户表格数据
      szUserList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 是否显示编辑框弹出层
      openEdit: false,
      // 账号类型字典
      accountTypeOptions: [],
      // 是否充值字典
      rechargeOptions: [],
      // 账号状态字典
      signOutOptions: [],
      // 直播状态字典
      frozenOptions: [],
      // 是否开通字典
      szEnableOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        nickname: null,
        phone: null,
        idNumber: null,
        accountType: null,
        recharge: null,
        invitationCode: null,
        invitationParent: null,
        szWalletBalance: null,
        szWithdrawalBalance: null,
        frozenAccount:null,
        szAgency: null,
        szEnergy: null,
        szEnable: null,
        szEnableTime: null,
        voucher: null,
        isSignOut: null,
        isFrozen: null
      },
      // 代理等级字典
      agencyOptions: [],
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        nickname: [
          { required: true, message: "昵称不能为空", trigger: "blur" }
        ],
        phone: [
          { required: true, message: "手机号不能为空", trigger: "blur" }
        ],
        idNumber: [
          { required: true, message: "身份证号不能为空", trigger: "blur" }
        ],
        accountType: [
          { required: true, message: "账号类型不能为空", trigger: "change" }
        ],
        szWalletBalance: [
          { required: true, message: "钱包余额不能为空", trigger: "blur" }
        ],
        szWithdrawalBalance: [
          { required: true, message: "提现钱包余额不能为空", trigger: "blur" }
        ],
        frozenAccount: [
          { required: true, message: "提现冻结金额不能为空", trigger: "blur" }
        ],
        szEnergy: [
          { required: true, message: "能量值不能为空", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("DMC002").then(response => {
      this.accountTypeOptions = response.data;
    });
    this.getDicts("DMC001").then(response => {
      this.rechargeOptions = response.data;
    });
    this.getDicts("DMC015").then(response => {
      this.szEnableOptions = response.data;
    });
    this.getDicts("DMC016").then(response => {
      this.signOutOptions = response.data;
    });
    this.getDicts("DMC017").then(response => {
      this.frozenOptions = response.data;
    });
    listSzVipRule().then(response => {
        this.agencyOptions = response.data;
    });
  },
  methods: {
    columnStyle({ row, column, rowIndex, columnIndex }) {
          if (columnIndex ==17||columnIndex ==19) {
        return 'background:rgba(242, 246, 252);'
        }
    },
    /** 查询平台用户列表 */
    getList() {
      this.loading = true;
      listSzUser(this.queryParams).then(response => {
        this.szUserList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.openEdit = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        memberId: null,
        nickname: null,
        phone: null,
        password: null,
        idNumber: null,
        avatar: null,
        accountType: null,
        lastLoginTime: null,
        lastLoginIp: null,
        lastUpdatePassword: null,
        registerTime: null,
        recharge: null,
        withdrawalLimitMonth: null,
        vip: null,
        baseGoldBalance: null,
        welfareGoldBalance: null,
        welfareWithdrawalBalance: null,
        invitationCode: null,
        invitationParent: null,
        szWalletBalance: null,
        szWithdrawalBalance: null,
        frozenAccount:null,
        szTeamReward: null,
        szRangeReward: null,
        szLateralReward: null,
        szRepeatbuyReword: null,
        szAgency: null,
        szEnergy: null,
        szEnable: null,
        szEnableTime: null,
        paymentPassword: null,
        voucher: null,
        invitationParent:null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加平台用户";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getSzUser(id).then(response => {
        this.form = response.data;
        this.openEdit = true;
      });
    },
    /** 新增 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateSzUser(this.form).then(response => {
              this.msgSuccess("操作成功");
              this.open = false;
              this.getList();
            });
          } else {
            addSzUser(this.form).then(response => {
              this.msgSuccess("操作成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 修改 提交按钮 */
    submitFormEdit() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateSzUser(this.form).then(response => {
              this.msgSuccess("操作成功");
              this.openEdit = false;
              this.getList();
            });
          } else {
            addSzUser(this.form).then(response => {
              this.msgSuccess("操作成功");
              this.openEdit = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 重置登录密码 按钮操作 */
    resetLoginPassword(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认重置平台用户的登录密码吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return resetLoginPassword(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("操作成功");
        }).catch(() => {});
    },
    /** 重置登录密码 按钮操作 */
    resetPaymentPassword(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确定重置平台用户的支付密码吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return resetPaymentPassword(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("操作成功");
        }).catch(() => {});
    },
    /** 注销、启用 按钮操作 */
    logoutOrEnable(row) {
      this.$confirm('确定要'+ (row.isSignOut==='0'?' 注销 ':' 启用 ') + row.nickname +'的平台账号吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          const formData = new FormData();
          formData.append('id', row.id);
          formData.append('type', row.isSignOut === '0' ? '1' : '0');
          return logoutOrEnable(formData);
        }).then(() => {
          this.getList();
          this.msgSuccess("操作成功");
        }).catch(() => {});
    },
    /** 删除 按钮操作 */
    deleteUser(row) {
      this.$confirm('确定要永久删除' + row.nickname +'的平台账号吗?', "严重警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "error"
        }).then(function() {
          const formData = new FormData();
          formData.append('id', row.id);
          formData.append('type', '1');
          return deleteUser(formData);
        }).then(() => {
          this.getList();
          this.msgSuccess("操作成功");
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有平台用户数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.exportLoading = true;
          return exportSzUser(queryParams);
        }).then(response => {
          this.download(response.msg);
          this.exportLoading = false;
        }).catch(() => {});
    },

  }

};
</script>
